<extend name="Public:base" />

<block name="content">
	<div class="page-header">

		<a href="{:U('BankList/add')}" class="btn btn-primary">新增</a>
	</div>

	<table class="table table-striped table-bordered table-hover search-form">
		<thead>
		<th><input name="keyword" type="text" placeholder="输入企业名称" value="{:I('keyword')}" /></th>
		<th>
			<select name="scid">
				<option value="">-选择分类-</option>
				<volist name="category" id="v" >
					<option <?php if(isset($get_scid)&&($get_scid==$v['sc_id'])){echo ' selected="selected"';} ?> value="{$v.sc_id}">{$v.name}</option>
				</volist>
			</select>
		</th>
		<th>
			<select name="status">
				<option value="">-选择状态-</option>
				<option <?php if(isset($status)&&($status==1)){echo ' selected="selected"';} ?> value="1">启用</option>
				<option <?php if(isset($status)&&($status==0)){echo ' selected="selected"';} ?> value="0">关闭</option>
			</select>
		</th>
		<th>
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Company/index')}">查询</a>
		</th>
		</thead>
	</table>

	<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>企业名称</th>
						<th>所属分类</th>
						<th>联系电话</th>
						<th>地址</th>
						<th>状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						<volist name="list" id="data" empty="$empty">
						<tr>
							<td>{$data.company_name}</td>
							<td>{$data.name}</td>
							<td>{$data.tel}</td>
							<td>{$data.address}</td>
							<td>
								<switch name="data.status">
									<case value="1">
										<span class="green bold">启用</span>
									</case>    
									<case value="0">
										<span class="red bold">关闭</span>
									</case>
								</switch>
							</td>
							<td>
								<a class="btn btn-xs btn-info" href='{:U("BankList/edit",array("id"=>$data["bank_id"]))}' >
									<i class="icon-edit bigger-120"></i>
								</a>
							</td>
						</tr>
						</volist>	
						
						<tr>
							<td colspan="5" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>
<block name="javascript">
	<script>
		$(function(){

			$("#search").click(function () {
				var url = $(this).attr('url');
				var query = $('.search-form').find('input,select').serialize();
				query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
				query = query.replace(/^&/g, '');
				if (url.indexOf('?') > 0) {
					url += '&' + query;
				} else {
					url += '?' + query;
				}
				window.location.href = url;
			});

			$('.copy').click(function(){
				$.ajax({
					url: "{:U('Goods/copy_goods')}",
					type: 'post',
					data: $('input:checked'),
					dataType: 'json',
					beforeSend: function() {
						$('.copy').attr('disabled', true);
						$('.copy').after('<span class="wait">&nbsp;<img src="__IMG__/loading.gif" alt="" /></span>');
					},
					complete: function() {
						$('.copy').attr('disabled', false);
						$('.wait').remove();
					},
					success: function(json) {
						$('.warning, .error').remove();

						if (json['redirect']) {

							location = json['redirect']

						}
					},
					error: function(xhr, ajaxOptions, thrownError) {
						alert('修改失败');
					}
				});
			});
		});
	</script>
</block>